package com.palnar.ilecker.model;

import java.io.Serializable;

import org.ksoap2.serialization.SoapObject;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

import com.palnar.ilecker.utils.XmlDocumentUtility;

public class ServiceStationType implements Serializable {	

	private Integer serverId = 0;
	private Integer clientId = 0;
	private String name = "";
	private Boolean isDeleted;

	private static String idArg = "Id";
	private static String nameArg = "Name";

	public ServiceStationType() {
		// TODO Auto-generated constructor stub
	}

	public Integer getServerId() {
		return this.serverId;
	}

	public Integer getClientId() {
		return clientId;
	}
	

	public String getName() {
		return this.name;
	}


	public void setServerId(Integer id) {
		this.serverId = id;
	}

	public void setName(String name) {
		this.name = name;
	}
	

	public void setClientId(Integer clientId) {
		this.clientId = clientId;
	}

	
	public void getSerializationData(Element parentElement, Document document) {

		Element idElement = document.createElement(idArg);
		Node idNode = document.createTextNode("id");
		idNode.setNodeValue(serverId.toString());
		idElement.appendChild(idNode);
		parentElement.appendChild(idElement);

		Element nameElement = document.createElement(nameArg);
		Node nameNode = document.createTextNode("name");
		nameNode.setNodeValue(name);
		nameElement.appendChild(nameNode);
		parentElement.appendChild(nameElement);

	}

	public static ServiceStationType ServiceStationTypeBuilder(SoapObject object) {
		ServiceStationType type = new ServiceStationType();

		Object ServiceStationTypeIdObj = object
				.getProperty("ServiceStationTypeId");

		if (!ServiceStationTypeIdObj.toString().equals(XmlDocumentUtility.nullString)) {
			type.setServerId(Integer.parseInt(ServiceStationTypeIdObj.toString()));
		}

		Object ServiceStationTypeNameObj = object
				.getProperty("ServiceStationTypeName");

		if (!ServiceStationTypeNameObj.toString().equals(XmlDocumentUtility.nullString)) {
			type.setName(ServiceStationTypeNameObj.toString());
		}

		return type;
	}
	
}
